package haxibiao

import "fmt"

func Intersection(nums1 []int, nums2 []int) []int {
	m1 := map[int]int{}
	m2 := map[int]int{}
	for i := 0; i < len(nums1); i++ {
		m1[nums1[i]]++
	}
	ans := make([]int, 0)
	for i := 0; i < len(nums2); i++ {
		if m1[nums2[i]] != 0 {
			m2[nums2[i]]++
		}
	}
	for k, _ := range m2 {
		ans = append(ans, k)
	}
	fmt.Println(ans)
	return ans
}
